package com.dao.impl;


import com.dao.StyleService;
import com.entity.Style;
import com.util.JdbcUtil;
import com.util.PageUtil;

import java.sql.SQLException;
import java.util.List;

/**
 * <p>
 * 歌曲风格 服务实现类
 * </p>
 *
 * @author lzy
 * @since 2022-03-23
 */
public class StyleServiceImpl implements StyleService {

	@Override
	public int insert(Style style) throws SQLException {
		return 0;
	}

	/**
	 * 查询所有未删除地风格
	 * @param style
	 * @return
	 * @throws IllegalAccessException
	 * @throws SQLException
	 * @throws InstantiationException
	 */
	@Override
	public List<Style> queryData(Style style) throws IllegalAccessException, SQLException, InstantiationException {
		String sql = "select * from style where is_deleted = 0 ";
		return JdbcUtil.queryData(sql, Style.class);
	}

	@Override
	public int update(Style style) throws SQLException {
		return 0;
	}

	/**
	 * 删除风格
	 * @param id
	 * @return
	 * @throws SQLException
	 */
	@Override
	public int deleteById(Object id) throws SQLException {
		String sql = "update style set is_deleted = 1 where style_id = ?";
		return JdbcUtil.insertOrUpdateOrDelete(sql, new Object[]{id});
	}

	@Override
	public PageUtil<Style> queryDataBypage(int currentPgae, int pageSize, Style style) throws IllegalAccessException, SQLException, InstantiationException {
		return null;
	}
}
